package com.csdj.controller;

import com.csdj.pojo.Dept;
import com.csdj.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class DeptController {
    @Autowired
    private DeptService deptService;

    @RequestMapping("/addDept")
    public ModelAndView addDept(){
        ModelAndView modelAndView = new ModelAndView();
        Dept dept = new Dept();
        dept.setId(1);
        dept.setName("研发部");
        dept.setMobile("12222222");
        dept.setManager(1);
        boolean result = deptService.addDept(dept);
        modelAndView.addObject("result",result);
        modelAndView.setViewName("dept");
        return  modelAndView;
    }
}
